#ifndef __MC_POINT_2_H__
#define __MC_POINT_2_H__

#include <iostream>
#include <sstream>
#include <cmath>
#include <vector>

using namespace std;

namespace mc{

template <typename T>
class Point2_{
    public:
        Point2_(T x = 0, T y = 0){
            this->x = x;
            this->y = y;
        };
        Point2_() = default;
        // Point2_(): x(0), y(0) {}


        void setX(T x)
        {
            this->x = x;
        }

        void setY(T y)
        {
            this->y = y;
        }

        string toString() const{
            std::stringstream ss;
            ss << "(" << this->x << ", " << this->y << ")";
            return ss.str();
        }

        T operator[](size_t i) const
        {
            return i == 0 ? this->x : this->y;      
        }

        bool operator==(const Point2_& other)
        {
            return (this->x == static_cast<T>(other.x())) && (this->y == static_cast<T>(other.y()));
        }        

        bool operator!=(const Point2_& other)
        {
            return !operator==(other);
        }

        // // 加法运算符
        // Point2_ operator+(const Point2_& other) const {
        //     return Point2_(this->x + other.x, this->y + other.y);
        // }

        // // 减法运算符
        // Point2_ operator-(const Point2_& other) const {
        //     return Point2_(this->x - other.x, this->y - other.y);
        // }

        // // 右乘常量（标量 * 点）
        // Point2_ operator*(const T& scalar) const {
        //     return Point2_(this->x * scalar, this->y * scalar);
        // }

        // // 左乘常量（点 * 标量），为了兼容左乘的情况
        // friend Point2_ operator*(const T& scalar, const Point2_& p) {
        //     return Point2_(p.x * scalar, p.y * scalar);
        // }

        // // 除法运算符（点 / 标量）
        // Point2_ operator/(const T& scalar) const {
        //     if (scalar == 0) {
        //         throw std::invalid_argument("Cannot divide by zero");
        //     }
        //     return Point2_(this->x / scalar, this->y / scalar);
        // }

        // // Overload += operator
        // Point2_& operator+=(const Point2_& other) {
        //     this->x += other.x;
        //     this->y += other.y;
        //     return *this;
        // }

        T x, y;    
};

}; //namespace
 
#endif